#ifndef _UBT_PROTO_NAV_H_
#define _UBT_PROTO_NAV_H_
namespace ubt_proto_nav
{
typedef struct
{
    int result;
    std::string desc;
} ubt_nav_msg_com_rsp;

typedef struct
{
    int state;
    std::string taskId;
    int flag;
    int stopState;
    int stopReason;
    int ttl;
    int lineIndex;
    int isRotate;
    int lastPointId;
    int nextPointId;
    int obstacle;
    float spdx;
    int waitLineIndex;
    int waitPointId;
    std::string stopReasonDesc;
} ubt_nav_status;

struct Point
{
    float x;
    float y;
    float t;
    unsigned short id;
    float avoidDis;
};

struct Limit
{
    float x;	//最终给到导航的x轴线速度,米/秒。根据机器人空载、负载状态选择的空载或者负载速度
    float w;	//最终给到导航的旋转速度,弧度/秒。根据机器人空载、负载状态选择的空载或者负载速度
};

struct Line
{
    std::string type;//线段类型 line或 bezier，或codes
    std::vector<Point> points;
    Limit limit;	//速度限制
};
#define LINE_TYPE_LINE  "line"
#define LINE_TYPE_BEZIER  "bezier"

typedef struct
{
    int ttl;
    int waitLineIndex;
    int waitPointId;
} ubt_nav_params;

typedef struct
{
    std::string taskId;
    std::vector<Line> path;
    ubt_nav_params params;
} ubt_nav_start_req;

typedef struct
{
    int reason;
    int duration;
    int clean;
} ubt_nav_stop_req;

typedef ubt_nav_params ubt_nav_setopt_req;

int ubtNavEncodeComRsp(std::string&	buf, ubt_nav_msg_com_rsp *pComRsp, std::string& failDesc);
int ubtNavEncodeStartReq(std::string&  buf, ubt_nav_start_req *pStartReq, std::string& failDesc);
int ubtNavEncodeStopReq(std::string&  buf, ubt_nav_stop_req *pStopReq, std::string& failDesc);
int ubtNavEncodeStatus(std::string&	buf, ubt_nav_status *pStatus, std::string& failDesc);
int ubtNavEncodeSetoptReq(std::string&	buf, ubt_nav_setopt_req *pSetoptReq, std::string& failDesc);


int ubtNavDecodeComRsp(std::string& buf, ubt_nav_msg_com_rsp *pComRsp, std::string& failDesc);
int ubtNavDecodeStartReq(std::string& buf, ubt_nav_start_req *pStartReq, std::string& failDesc);
int ubtNavDecodeStopReq(std::string&  buf, ubt_nav_stop_req *pStopReq, std::string& failDesc);
int ubtNavDecodeStatus(std::string& buf, ubt_nav_status *pStatus, std::string& failDesc);
int ubtNavDecodeSetoptReq(std::string& buf, ubt_nav_setopt_req *pSetoptReq, std::string& failDesc);


}



#endif

